<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>object ,array</title>
    <script type="text/javascript">

        var obj=new Object();
        obj.name="zhang";
        obj.age=100;
        obj.toString=function(){
            return this.name;
        }
        console.log(obj)
        //alert(obj);
        console.log(obj.name);
        console.log("obj['name']:"+obj['name']);

        var arr=new Array();
        var arr1=new Array("DA","DA","DDFFD");
        var arr2=new Array(10);
        arr2[1]='da';
        arr2[0]=10;
        arr2[2]=true;
        arr2[3]=2.3;
        arr2[4]=obj;
        console.log('---------------');
        console.log(arr);
        console.log(arr1);
        console.log(arr2);
        console.log(arr2.length);
        console.log(typeof arr2);//object
        console.log(typeof arr);//object

        //
        console.log("----棧---------");
        var arrz=['das','dsa'];
        arrz.push("saasaa");
        console.log(arrz);
        console.log(arrz.push('push'));
        console.log(arrz.pop());

        console.log("----------dui'lie队列")
        var a=['da','sss'];
        console.log(a);
        console.log(typeof a);
        console.log(a.shift());//从前面取
        console.log(a);

        console.log("---------------arr方法");
        var ar=[1,4,565,3,2];
        console.log(ar.reverse());
        console.log(ar.sort());
        console.log(ar);
        function comparse(a1,a2){
            if(a1<a2){
                return true;
            }
            return false;
        }
        console.log(ar.sort(comparse));
        console.log(ar.concat(100))//合并数组
        console.log(ar.slice(3));//从第三个开始取
        ar=[1,4,565,3,2];
        console.log(ar);
        console.log("--")
        console.log(ar.slice(1,3));//从多少取到多少
        ar=["as","da2","das3","ds34"];
        console.log(ar.slice(1,1,24));
        console.log(ar)
    </script>
</head>
<body>
    <div id="divBody">
        <div id="divTitile">title</div>
        dfs
    </div>
</body>
</html>